<template>
  <div>
    <h1>$nextTick练习</h1>
    <input ref="inp" v-if="isShow" placeholder="请输入搜索内容" type="text" >
    <button v-else @click="search">搜索</button>
  </div>
</template>

<script>
export default {
  name: 'VueDay4App',

  data() {
    return {
      isShow:false
      
    };
  },

  mounted() {
    
  },

  methods: {
    search(){
      this.isShow = true
      this.$nextTick(() => {
        this.$refs.inp.focus()
      })
    }
    
  },
};
</script>

<style lang="scss" scoped>

</style>